<?php
$xtypes = array('resume', 'event', 'offer', 'entry');
$summary = $_['summary'];
?>
<div class="rep_resumefrom" id="anchor_from">
   <h5><b>来源情况</b></h5>
   <div class="rep_detailtable">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <th width="12%">来源</th>
            <th width="22%">新增简历</th>
            <th width="22%">进入面试</th>
            <th width="22%">发offer</th>
            <th width="22%">入职</th>
         </tr>
         <? if (!empty($summary['source']['total']) || !empty($summary['source']['pies'])):
            $sourceList = array(
               'upload' => array('text' => '枇杷派', 'class' => 'pipapai'),
               '51job' => array('text' => '前程无忧', 'class' => 'job51'),
               'zhilian' => array('text' => '智联招聘', 'class' => 'zhilian'),
               'lagou' => array('text' => '拉勾', 'class' => 'lagou'),
               'jiancai' => array('text' => '建筑英才', 'class' => 'jiancai')
            );
            $sources = array_keys($summary['source']['total']);
            $sources_sorted = array_keys($sourceList);
            $sources = array_values(array_intersect($sources_sorted, $sources));
            foreach($sources as $s):
               $t = $summary['source']['total'][$s];
            ?>
            <tr>
               <td class="tleft"><i class="<?=$sourceList[$s]['class']?>"></i> <?=$sourceList[$s]['text']?></td>
               <? foreach($xtypes as $x): ?>
                  <td><div style="position:relative;"><b><?=(!empty($t[$x]['count']) ? $t[$x]['count'] : 0)?></b><em class="baifenbi">(<?=(!empty($t[$x]['weight']) ? $t[$x]['weight'] : '0%')?>)</em></div></td>
               <? endforeach; ?>
            </tr>
            <? endforeach; ?>
            <tr>
               <td></td>
               <? foreach($xtypes as $x): ?>
                  <? if (!empty($summary['source']['pies'][$x])): ?>
                     <td><div id="<?=$x?>Source" class="sourcePie" data-xtype="<?=$x?>" style="height:165px; width:165px; margin:auto;"></div></td>
                  <? else: ?>
                     <td><div class="nodatacolor">暂无数据</div></td>
                  <? endif; ?>
               <? endforeach; ?>
            </tr>
         <? else: ?>
            <tr><td colspan=5><div class="nodatacolor">暂无数据</div></td></tr>
         <? endif; ?>
      </table>
   </div>
</div>
<?php
$resumeParseList = array(
   'match_degree' => array(
      'text'    => '匹配度',
      'weights' => array('20%以下/其他', '20%-50%', '50%-75%', '75%-100%'),
      'show'    => 1
   ),
   'degree_level' => array(
      'text'    => '学历',
      'weights' => array('初中及以下', '高中/中专', '大专', '本科', '硕士及以上', '其他'),
      'show'    => 1
   ),
   'workexp' => array(
      'text'    => '工作经验',
      'weights' => array('应届毕业生', '不满1年', '1-2年', '2-5年', '5-10年', '10年以上', '其他'),
      'show'    => 1
   ),
   'target_salary' => array(
      'text'    => '期望月薪',
      'weights' => array('2000元以下', '2000-5000元', '5000-8000元', '8000-10000元', '10000元以上'),
      'show'    => 0
   ),
   'age' => array(
      'text'    => '年龄',
      'weights' => array('25岁以下', '25-30岁', '30-35岁', '35-40岁', '40-50岁', '50岁以上', '其他'),
      'show'    => 0
   ),
   'sex' => array(
      'text'    => '性别',
      'weights' => array('男', '女'),
      'show'    => 0
   )
);
?>
<div class="rep_resumefrom" id="anchor_resumeparse">
   <h5 id="resumeParseTitle">
      <b>人才分析</b>
      <? foreach ($resumeParseList as $w => $r): ?>
         <label class="checkbox inline <?=($r['show'] ? 'checkedbox' : '')?>">
            <input type="checkbox" data-target=".<?=$w?>" data-anchor="#<?=$w?>" class="resumeparse" <?=($r['show'] ? 'checked="checked"' : '')?>> <?=$r['text']?>
         </label>
      <? endforeach; ?>
      <!--
      <label class="checkbox inline">
         <input type="checkbox" id="" value=""> 职能类别
      </label>
      <label class="checkbox inline">
         <input type="checkbox" id="" value=""> 行业
      </label>
      -->
   </h5>
   <? foreach ($resumeParseList as $w => $r): ?>
   <div id="<?=$w?>" class="rep_detailtable item <?=$w?> <?=($r['show'] ? '' : 'hide')?>" style="margin-bottom:30px;">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <th width="12%"><?=$r['text']?></th>
            <th width="22%">新增简历</th>
            <th width="22%">进入面试</th>
            <th width="22%">发offer</th>
            <th width="22%">入职</th>
         </tr>
         <? if (!empty($summary['resumeParse']['total'][$w])):
            $colorIndex = array_flip($r['weights']);
            $wdata = $summary['resumeParse']['total'][$w];
            $wtexts = array_keys($wdata);
            $wtexts_sorted = array_values($r['weights']);
            $wtexts = array_values(array_intersect($wtexts_sorted, $wtexts));
            foreach ($wtexts as $wtext):
               $t = $wdata[$wtext]
         ?>
               <tr>
                  <td style="padding:0px; text-align:left;">
                     <div class="rep_homerctitle" style="background:none; text-align:left;">
                        <div class="rep_bgcolortip">
                           <span><i class="bgc_<?=$colorIndex[$wtext]?>"></i> <?=$wtext?></span>
                        </div>
                     </div>
                  </td>
                  <? foreach($xtypes as $x): ?>
                  <td><div style="position:relative;"><b><?=(!empty($t[$x]['count']) ? $t[$x]['count'] : 0)?></b><em class="baifenbi">(<?=(!empty($t[$x]['weight']) ? $t[$x]['weight'] : '0%')?>)</em></div></td>
                  <? endforeach; ?>
               </tr>
            <? endforeach; ?>

            <tr>
               <td></td>
               <? foreach($xtypes as $x): ?>
                  <? if (!empty($summary['resumeParse']['donuts'][$w][$x])): ?>
                     <td><div id="<?=$w.$x?>" class="resumeDonut <?=($r['show'] ? 'show' : '')?>" data-wtype="<?=$w?>" data-xtype="<?=$x?>" style="height:165px; width:165px; margin:auto;"></div></td>
                  <? else: ?>
                     <td><div class="nodatacolor">暂无数据</div></td>
                  <? endif; ?>
               <? endforeach; ?>
            </tr>
         <? else: ?>
            <tr><td colspan="5"><div class="nodatacolor">暂无数据</div></td></tr>
         <? endif; ?>
      </table>
   </div>
   <? endforeach; ?>
   <div class="noItem hide">请选择分析项目</div>
</div>